/**
 * 
 */
package com.detroitchow2;

import com.google.android.gms.common.GooglePlayServicesUtil;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

/**
 * @author dave
 *
 */
public class AboutActivity extends Activity
{

  /* (non-Javadoc)
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    TextView attrib = (TextView) this.findViewById(R.id.gmap_attrib);
    attrib.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo (this));
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu)
  {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    ActionBar actionBar = getActionBar(); // || getActionBar();
    actionBar.setIcon(getResources().getDrawable(R.drawable.action_bar_icon));
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle("");
    return true;
    
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) 
  {
    Intent intent;
    
    switch (item.getItemId()) {
        case android.R.id.home:
          intent = new Intent(this, MainActivity.class);
          startActivityForResult(intent, 0);
          return false;
        case R.id.refresh:
          
          //LogUtil.log("onClick", "Click event is btnRefresh");
          intent = new Intent(this, MainActivity.class);
          intent.putExtra(AppIntent.REFRESH, true);
          startActivityForResult(intent, 0);
          return false;
          
        case R.id.search:
          
          intent = new Intent(this, SearchActivity.class);
          startActivityForResult(intent, 0);
          return false;
        case R.id.location:
          
          intent = new Intent(this,  MapScreen.class);
          intent.putExtra(AppIntent.MAP_INTENT, AppIntent.LOCATION);
          startActivityForResult(intent, 0);
          return false;
        default:
            return super.onOptionsItemSelected(item);
    }
  }
  

}
